<div class="bjui-pageHeader">
    <div class="pull-right">
        <!-- <button type="button" class="btn-default send_email" data-icon="envelope" title="发邮件" data-toggle="tooltip" data-placement="bottom"></button> -->
        <button type="button" class="btn-default send_msg" data-icon="envelope-o" title="发站内信" data-toggle="tooltip" data-placement="bottom"></button>
        <button class="btn-default" data-icon="plus" title="添加商家" data-toggle="tooltip" data-placement="bottom" onclick="createNavtab('{:U("Forms/addshop")}', '新增商家', 'addshop')" ></button>
        <!-- <a href="{:U('index/save')}" class="btn btn-default" data-toggle="doajaxchecked" data-icon="remove" data-callback="callbackRefres" data-confirm-msg="要删除全部选中的吗??" data-idname="id" data-group="ids"></a> -->
        <button class="btn-default" data-icon="refresh" onclick="$.CurrentNavtab.navtab('refresh')"></button>
    </div>
    <form id="pagerForm" data-toggle="ajaxsearch" data-loadingmask="true" action="{:U('index')}" method="post">
        <input type="hidden" name="pageSize" value="{:I('param.pageSize')}" />
        <input type="hidden" name="pageCurrent" value="{:I('param.pageCurrent')}" />
        <input type="hidden" name="orderField" value="{:I('param.orderField')}" />
        <input type="hidden" name="orderDirection" value="{:I('param.orderDirection')}" />
        <div class="bjui-searchBar">
            <label>显示状态:</label>
            <select name="status" data-toggle="selectpicker">
                <option value="">全部</option>
                <option value="0" <if condition="I('status') eq '0'">selected</if>>正常</option>
                <option value="1" <if condition="I('status') eq '1'">selected</if>>已关闭</option>
            </select>
           <label>审核状态:</label>
            <select name="is_check" data-toggle="selectpicker">
                <option value="">--请选择--</option>
                <option value="0" <if condition="I('is_check') eq '0'">selected</if>>未审核</option>
                <option value="1" <if condition="I('is_check') eq '1'">selected</if>>已审核</option>
                <option value="2" <if condition="I('is_check') eq '2'">selected</if>>审核未通过</option>
            </select>
            <label>关键字:</label>
            <input type="text" name="name" value="{:I('name')}"placeholder="商家名称、账号、地址" />
            <button type="submit" class="btn-default" data-icon="search">查询</button>
            <a class="btn btn-orange" href="javascript:;" data-toggle="reloadsearch" data-clear-query="true" data-icon="undo">清空查询 </a>
        </div>
    </form>
</div>
<div class="bjui-pageContent tableContent">
    <table class="table table-bordered table-hover table-striped table-top" data-selected-multi="false">
        <thead>
        <tr>
            <th width="26"><input type="checkbox" class="checkboxCtrl" data-group="ids" data-toggle="icheck"></th>
            <th>登陆账号</th>
            <th>公司名称</th>
            <th>添加时间</th>
            <th>审核状态</th>
            <th>状态</th>
            <!--<th>手机号码</th>
            <th>余额</th>
            <th>积分</th>
            <th>注册日期</th> -->
            <th width="140">操作</th>
        </tr>
        </thead>
        <tbody>
        <volist name="list" id="vo">
        <tr>
            <td width="26"><input type="checkbox" value="{$vo.id}" class="checkboxCtrl" name="ids" data-toggle="icheck"></td>
            <td>{$vo.username}</td>
            <td>{$vo.shop_name}</td>
            <td>{$vo.add_time}</td>
            <td><if condition="$vo.is_check eq '0'">未审核<else/>已审核 审核人：{$vo.adminname}</if></td>
            <td>
            <if condition="$vo.close eq '0'">
               <a href="{:U('Forms/update_shop',array('id'=>$vo['id']))}" data-type="get" data-toggle="doajax" data-confirm-msg="确定要关闭这个商家吗??">正常</a>
            <else/>
               <a href="{:U('Forms/update_shop',array('id'=>$vo['id']))}" data-type="get" data-toggle="doajax" data-confirm-msg="确定要开启这个商家吗??">已关闭</a>
            </if>
            </td>
            <!-- <td>0</td>
            <td>{$vo.mobile}</td>
            <td>{$vo.balance}</td>
            <td>{$vo.point}</td>
            <td>{$vo.add_time}</td> -->
            <td>
                <button type="button" class="btn-green" onclick="createNavtab('{:U("Forms/addshop",array('id'=>$vo["id"]))}', '编辑商家资料', 'member_msg')">改</button>
                <if condition="$vo.is_check eq '0'">
                <button type="button" class="btn-green" onclick="createDialog('{:U("Forms/checkshop",array("id"=>$vo["id"]))}', '审核商家', 'member_msg', {width:800, height:500})">审</button>
                </if>
                <a href="{:U('Forms/del_shop',array('id'=>$vo['id']))}" data-type="get" class="btn btn-red" data-toggle="doajax" data-confirm-msg="你确定要删除吗？删除之后就不能恢复啦" >删</a>
            </td>
        </tr>
        </volist>
        </tbody>
    </table>
</div>
<script>
    $(function () {
        function checkout() {
            var ids = [];
            $.CurrentNavtab.find('input[name=ids]').each(function (index, item) {
                if(item.checked){
                    ids.push(item.value);
                }
            });
            return ids;
        }
       $('.send_email').click(function () {
            var ids = checkout();
           if( ids.length < 1 ){
               $(this).alertmsg('error', '请至少选择一位会员');
               return ;
           }
           createDialog('{:U("Forms/email")}?uid='+ids.join(','), '发邮件', 'send_email', {width:800, height:500} ) ;
       });
        $('.send_msg').click(function () {
            var ids = checkout();
            if( ids.length < 1 ){
                $(this).alertmsg('error', '请至少选择一位会员');
                return ;
            }
            createDialog("{:U('Forms/msg')}?uid=" + ids.join(','), '发站内信', 'send_msg', {width:800, height:500});
        });
    });
</script>
<include file="Common/footer" ftype="page" />